package me.dz.dreamcleaner.runnable;

import me.dz.dreamcleaner.utils.FileUtils;
import org.bukkit.scheduler.BukkitRunnable;

import static me.dz.dreamcleaner.DreamCleaner.*;

public class LogTask extends BukkitRunnable {

    private int n = 0;

    @Override
    public void run() {
        if (logClear){
            n++;
            if (n >= logCheck){
                n = 0;
                if (logItem){
                    FileUtils.clearFiles(itemFile);
                }
                if (logDense){
                    FileUtils.clearFiles(denseFile);
                }
                if (logTrash){
                    FileUtils.clearFiles(trashFile);
                }
                if (logGather){
                    FileUtils.clearFiles(gatherFile);
                }
                if (logChat){
                    FileUtils.clearFiles(chatFile);
                }
            }
        }
    }
}
